<template>
  <div class="app-container">
    <div class="filter-container" style="margin-bottom: 10px;">
      <el-input
        v-model="keyword"
        type="textarea"
        :rows="7"
        placeholder="请输入关键词"
      >
      </el-input>
      <aside style="margin-top: 10px; font-size: 14px; color: #F56C6C;">格式说明：每个关键词用英文逗号分割，不支持换行，例如：你好,*世界</aside>
    </div>
    <el-button class="filter-item" type="primary" @click="handleSend">提 交</el-button>
  </div>
</template>

<script>
import { getKeyword, handleKeyword } from '@/api/chat'

export default {
  name: 'Keyword',
  data() {
    return {
      id: '',
      keyword: '',
      header: {
        Authorization: this.$store.state.user.token
      }
    }
  },
  mounted() {
  },
  created() {
    this.getContent()
  },
  methods: {
    async getContent() {
      const res = await getKeyword()
      this.id = res.data.id
      this.keyword = res.data.keyword
    },

    handleSend() {
      handleKeyword({ keyword: this.keyword, id: this.id }).then(response => {
        if (response.status) {
          this.getContent()
          this.$message({
            type: 'success',
            message: '操作成功!'
          })
        }
      })
    }

  }
}
</script>
